#include<stdio.h>
#include<stdbool.h>
int max_days[13] = {0,31,28,31,30,31,30,31,31,30,31,30,31};
bool check(int year, int month, int day) {
    if(month == 0 || month > 12)
        return false;
    if(day == 0)
        return false;
    if(month != 2) {
        if(day > max_days[month])
            return false;
    }
    else {
        int leap = (year % 4 == 0 && year % 100) || (year % 400 == 0);
        if(day > 28 + leap)
            return false;
    }
    return true;
}
int main() {
    int n,ans = 0,sum = 0;
    scanf("%d", &n);
    int pd1 = 1,pd2 = 1,pd3 = 1;
    for(int y = 2023;;y++) {
        int m;
        if(pd1) {
            m = 9;
            pd1 = 0;
        }
        else m = 1;
        for(; m <= 12; m++) {
            int d;
            if(pd2) {
                d = 17;
                pd2 = 0;
            }
            else d = 1;
            for(; d <= 31; d++) {
                if(!check(y, m, d))
                    break;
                sum += 31;
                ans++;
                if(d == max_days[m]) {
                    if(pd3) {
                        pd3 = 0;
                    }
                    else sum += 30;
                }
                if(sum >= n) {
                    printf("%d", ans);
                    return 0;
                }
            }
        }
    }
}